#ifndef __WORK_H__
#define __WORK_H__
#include <stdint.h>
#include <server_conf.h>
#include <threadpool.h>
#include <nodelist.h>

//客户端数据类型
enum data_type
{
	CLIENT_ID = 1,
	DETECT_ID,
	DATA,
	CMD,
	QUERY,
	HEARTBEAT,
	DATATYPEMAX
};

//客户端上报ID结构体
struct clientid_st
{
	unsigned short type;
	unsigned short datalenth;
	char id[IDSIZE];
	uint8_t crc16_l;
	uint8_t crc16_h;
};

//客户端sql查询结构体
struct queryid_st
{
	unsigned short type;
	unsigned short datalenth;
	char id[IDSIZE];
	unsigned short rows;
	uint8_t crc16_l;
	uint8_t crc16_h;
};

//监控客户端结构体
struct detectid_st
{
	unsigned short type;
	unsigned short datalenth;
	char id[IDSIZE];
	char clientid[IDSIZE];
	uint8_t crc16_l;
	uint8_t crc16_h;
};

//数据及命令结构体
struct data_st
{
	unsigned short type;
	unsigned short datalenth;
	char data[BUFFSIZE];
	uint8_t crc16_l;
	uint8_t crc16_h;
};

//共用体(方便查询数据类型)
union packetData
{
	unsigned short type;
	struct clientid_st client;
	struct detectid_st detect;
	struct data_st     data;
	struct queryid_st  query;
};

int func_handler(void *data);

#endif

